//Test.java
public class Test {

    public static void main(String[] args) {
        //向上转型
        School school=new Student1("113");
        if(school instanceof Student1){
            Student1 student1=(Student1) school;
            student1.study();
        }
        if(school instanceof Student2){
            Student2 student2=(Student2) school;
            student2.clean();
        }
    }
}

//   Student2 student2=(Student2) school;
//        student2.study();//study（）爆红，因为student2类的实例对象School没有study（）这个方法
//        school.play();
//         school1.study();//编译错误，向上转型后不能调用子类特有的方法
//    Student1 student1=(Student1) school;
//   public static void eat(School school){
//        school.play();
//    }
//    public static void main(String[] args) {
//        Student1 student1=new Student1("java113",10);
//        Student2 student2=new Student2("java114",9);
//
//        eat(student1);
//        eat(student2);
//    }
//    public static int add(int a,int b){
//        return a+b;
//    }
//    public static double add(double a,double b,double c){
//        return a+b+c;
//    }
//    public static void main(String[] args) {
//        int a=10;
//        int b=20;
//
//    }